﻿using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.Security;

namespace Bartomolina.SharePoint.SPBM.OneStepImage
{
    [CLSCompliant(false)]
    [Guid("52728452-f035-42e0-8b27-96ff3010a889")]
    public class OneStepImageField : SPFieldMultiLineText
    {
        public OneStepImageField(SPFieldCollection fields, string fieldName)
            : base(fields, fieldName)
        {
        }
        
        public OneStepImageField(SPFieldCollection fields, string typeName, string displayName)
            : base(fields, typeName, displayName)
        {
        }

        public override BaseFieldControl FieldRenderingControl
        {
            [SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
            get
            {
                BaseFieldControl fieldControl = new OneStepImageFieldControl();
                fieldControl.FieldName = this.InternalName;

                return fieldControl;
            }
        }
    }
}
